<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Sendemail extends CI_Controller {

    function __construct() {
        parent::__construct();
        date_default_timezone_set('Europe/Berlin');
        $this->load->library('email');
        $config['mailtype'] = 'html';
//        $config['protocol'] = 'sendmail';
        $config['protocol']='smtp';  
        $config['smtp_host'] = 'ssl://smtp.googlemail.com';
        $config['smtp_port'] = '465';
        $config['smtp_timeout'] = '30';
        $config['smtp_user'] = 'wajdi.ben.slimane@gmail.com';
        $config['smtp_pass'] = 'iamalion_9';
        $config['charset'] = 'utf-8';
        $config['newline'] = "\r\n";
        $this->email->initialize($config);
    }

    public function index() {

    }
    function sendEmail() {  
        $this->email->from('your@example.com', 'Your Name');
        $this->email->reply_to('you@example.com', 'Your Name');
        $this->email->to('wajdi.ben.slimane@googlemail.com');
        $this->email->cc('');
        $this->email->bcc('');

        $this->email->subject('Email Test');
        $data['picture'] = "http://i.ytimg.com/vi/O0Qa212nriA/hqdefault.jpg";
        $data['desc'] = 'http://www.ryandoyle.co.uk http://www.redbull.com http://www.wfpf.com Ryan on his new series around the world';
        $data['link'] ='http://leapdemo.com/videos/O0Qa212nriA';
        $data['profile'] ='http://leapdemo.com/benslimane9';
        $data['username'] = 'Josef Slimane';
        
        $body =  $this->load->view( 'emails/message',$data ,true);
        
        //$this->email->message($body);
        
        //$this->email->send();

        echo $body;
    }
}